package com.unisyou.utils;

import java.net.InetAddress;
import java.net.UnknownHostException;

public class WXUtils {
    /**
     * 获取ip地址
     * @return
     */
    public static String getLocalIP() {
        InetAddress addr = null;
        try {
            addr = InetAddress.getLocalHost();
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
        byte[] ipAddr = addr.getAddress();
        String ipAddrStr = "";
        for (int i = 0; i < ipAddr.length; i++) {
            if (i > 0) {
                ipAddrStr += ".";
            }
            ipAddrStr += ipAddr[i] & 0xFF;
        }
        return ipAddrStr;
    }

    /**
     * 获取微信支付唯一订单号
     * @return
     */
    public static String getOrderId(){
        return DateUtils.getDate("yyyyMMddHHmmss") + (int)(Math.random()*1000000);
    }
}
